/*
 * @Description: 服务器管理
 * @Date: 2023-11-16 09:18:11
 * @FilePath: \hksj-vued:\03code\hk-iot\src\api\configuration\server\index.ts
 */
import request from '/@/utils/request';

/**
 * @method queryEnergyTypeTree 查询类型书
 * @method updateEnergyType 修改类型详情
 * @method updateEnergyCost 修改费率阶梯
 * @method addEnergyType 添加类型
 * @method queryServerListByPaging 分页查询
 * @method deleteAlarmConfiguration 删除报警配置
 * 
 * @method addAlarmConfiguration 新增报警配置
 * @method queryAlarmDevice 通过设备id查询报警配置列表
 * @method updateAlarmConfiguration 更新报警配置
 * @method deleteAlarmConfiguration 删除报警配置
 */
export function usedeviceApi() {
  return {
    queryDevice: (params: object) => {
      return request({
        url: '/api/mqtt/device/queryDeviceByPaging',
        method: 'POST',
        data: params,
      });
    },
    addDevice: (params: object) => {
      return request({
        url: '/api/mqtt/device/addDevice',
        method: 'POST',
        data: params,
      });
    },
    queryGateway: (params: object) => {
      return request({
        url: '/api/mqtt/device/listGateway',
        method: 'POST',
        data: params,
      });
    },
    updateDevice: (params: object) => {
      return request({
        url: '/api/mqtt/device/updateDevice',
        method: 'PUT',
        data: params,
      });
    },
    deleteDevice: (id: string) => {
      return request({
        url: `/api/mqtt/device/deleteDevice/${id}`,
        method: 'DELETE',
      });
    },
    queryAlarmDevice: (id: Number) => {
      return request({
        url: `/api/mqtt/alarmConfiguration/queryAlarmConfigurationListByDeviceId?deviceId=${id}`,
        method: 'GET',
      });
    },
    addAlarmConfiguration: (params: object) => {
      return request({
        url: '/api/mqtt/alarmConfiguration/addAlarmConfiguration',
        method: 'POST',
        data: params,
      });
    },
    updateAlarmConfiguration: (params: object) => {
      return request({
        url: '/api/mqtt/alarmConfiguration/updateAlarmConfiguration',
        method: 'PUT',
        data: params,
      });
    },
    deleteAlarmConfiguration: (id: string) => {
      return request({
        url: `/api/mqtt/alarmConfiguration/deleteAlarmConfiguration/${id}`,
        method: 'DELETE',
      });
    },
  };
}
